﻿# ---------------------------------------------------------------------- #
# Create default templates                                               #
# ---------------------------------------------------------------------- #
INSERT INTO jsc_template(`name`, `description`, `path`, `controlname`, `css`) VALUES('Top bottom left right', '', '/Templates/css-layouts/', 'top-bottom-left-right.ascx', 'top-bottom-left-right.css');
SELECT @defaulttemplateid := last_insert_id();
# ---------------------------------------------------------------------- #
# Create default site                                                    #
# ---------------------------------------------------------------------- #
INSERT INTO jsc_site(`defaulttemplateid`, `name`, `url`, `defaultlanguage`, `validfrom`, `webmastermail`) VALUES(1, 'Default site', 'http://localhost:8080', 'en-US', '2008-01-01 00:00:00', 'root@root.com');
SELECT @siteid := last_insert_id();
# ---------------------------------------------------------------------- #
# Create roles                                                           #
# ---------------------------------------------------------------------- #
INSERT INTO jsc_role(`roleid`, `name`, `description`) VALUES(0, 'Administrator', '');
INSERT INTO jsc_role(`roleid`, `name`, `description`) VALUES(1, 'SiteAdministrator', '');
INSERT INTO jsc_role(`roleid`, `name`, `description`) VALUES(2, 'Editor', '');
INSERT INTO jsc_role(`roleid`, `name`, `description`) VALUES(3, 'Authenticated', '');
INSERT INTO jsc_role(`roleid`, `name`, `description`) VALUES(4, 'Anonymous', '');
# ---------------------------------------------------------------------- #
# Create default users													 #
# Administrator, password: admin										 #
# SiteAdministrator, password: site-admin                                #
# ---------------------------------------------------------------------- #
INSERT INTO jsc_user(`siteid`, `username`, `password`, `passwordsalt`, `email`, `isactive`) VALUES(@siteid, 'Administrator', 'C6AiN2wNxJl4xbvgDcVUs4x1gn0=', 's2lLZff4NCfBuzri1z7GnLk6H9vLDWNmBTzVy7ma2QY=', 'mail@domain.com', true);
SELECT @adminuserid := last_insert_id();
INSERT INTO jsc_userrole(userid, roleid) VALUES(@adminuserid, 0);
INSERT INTO jsc_user(`siteid`, `username`, `password`, `passwordsalt`, `email`, `isactive`) VALUES(@siteid, 'SiteAdministrator', 'rJN81kQYJYV5gFsbu9LcaOEVQAE=', '5Bj8TC3YGSM84Nlai56hBnj6R810hikK85hLa0m4dCI=', 'mail@domain.com', true);
SELECT @userid := last_insert_id();
INSERT INTO jsc_userrole(userid, roleid) VALUES(@userid, 1);
# ---------------------------------------------------------------------- #
# Create root page                                                       #
# ---------------------------------------------------------------------- #
INSERT INTO jsc_page(`siteid`, `name`, `language`, `templateid`, `friendlyurl`, `position`, `showinnavigation`, `validfrom`) VALUES(@siteid, 'Root', 'en-US', @defaulttemplateid, 'root', 0, true, '2008-01-01 00:00:00');
SELECT @rootpageid := last_insert_id();
INSERT INTO jsc_pagerole(`pageid`, `roleid`, `viewallowed`, `editallowed`) VALUES(@rootpageid, 0, true, true);
INSERT INTO jsc_pagerole(`pageid`, `roleid`, `viewallowed`, `editallowed`) VALUES(@rootpageid, 1, true, true);
INSERT INTO jsc_pagerole(`pageid`, `roleid`, `viewallowed`, `editallowed`) VALUES(@rootpageid, 2, true, false);
INSERT INTO jsc_pagerole(`pageid`, `roleid`, `viewallowed`, `editallowed`) VALUES(@rootpageid, 3, true, false);
INSERT INTO jsc_pagerole(`pageid`, `roleid`, `viewallowed`, `editallowed`) VALUES(@rootpageid, 4, true, false);